<template>
	<div id="refund_query" class="container">
		<div class="content">
			<!-- <div class="title">{{title}}</div> -->
			
			<div class="general">
				<div class="sub_title">退费概况</div>
				<div class="general_left">
					<div class="left_1">￥{{allMoney}}</div>
					<div class="left_2">总退费</div>
					<div class="left_3" id="chart1"></div>
				</div>
				<div class="general_right" id="chart2"></div>
			</div>
			
			<div class="query">
				<div class="sub_title">退费查询</div>
				<div class="row_1">
					<el-input style="width: 4.1rem;" clearable v-model="param.keyName" maxlength="100"
			   				  placeholder="搜索 学员/手机号/班级名称 /订单号">
	  				</el-input>
					&nbsp;
					<div class="search_btn" @click="search()" v-if="hasApi('moneyList')">搜索</div>
					<div class="tab_div">
						<div class="tab_day" :class="timeType=='day'?'tab_active':''" @click="selectTimeType('day')">今日</div>
						<div class="tab_week" :class="timeType=='week'?'tab_active':''" @click="selectTimeType('week')">本周</div>
						<div class="tab_month" :class="timeType=='month'?'tab_active':''" @click="selectTimeType('month')">本月</div>
						<div class="tab_custom" :class="timeType=='custom'?'tab_active':''">自定义</div>
						
						<el-date-picker v-model="customTime" class="custom_picker" @focus="customTimeChange" 
							@change="customTimeChange" type="daterange" value-format="yyyy-MM-dd"
							range-separator="" start-placeholder="开始日期"  end-placeholder="结束日期">
						</el-date-picker>
					</div>
				</div>
				<div class="table_div">
					<table class="table" cellspacing="0">
						<thead class="thead">
							<tr>
								<td style="width: 2.7rem;">退费单号</td>
								<td style="width: 0.5rem;"></td>
								<td style="width: 3.4rem;padding-right: 1rem;">课程/商品/订金/餐费</td>
								<td style="width: 1.4rem;">退费学员</td>
								<td style="width: 1.3rem;">实际退费</td>
								<td style="width: 2.2rem;">退费时间</td>
								<td style="width: 1.5rem;">支付方式</td>
								<td style="width: 1.2rem;">状态</td>
								<td style="width: 1.2rem;">操作</td>
							</tr>
						</thead>
						<tbody class="tbody">
							<tr v-for="item,index in refundList">
								<td>
									<template v-if="item.billMode!=4">
										{{item.billId}}
									</template>
								</td>
								<td>
									<span v-if="item.billMode==2" class="mark_course">课</span>
									<span v-if="item.billMode==4" class="mark_earnest">订</span>
									<span v-if="item.billMode==5" class="mark_goods">商</span>
									<span v-if="item.billMode==8" class="mark_meal">餐</span>
								</td>
								<td style="text-align: left;">
									<template v-if="item.billMode==2">
										{{item.className? item.className + " /" : ""}}
										{{item.courseName}}
									</template>
									<template v-if="item.billMode==4">
										订金
									</template>
									<template v-if="item.billMode==5">
										<span v-for="goods,num in item.refundGoodsData"
											  style="font-size: 0.16rem;">{{num!=0?'，':''}}{{goods.goodsName}}</span>
									</template>
									<template v-if="item.billMode==8">
										<span v-for="meal,num in item.refundMealsData"
											  style="font-size: 0.16rem;">{{num!=0?'，':''}}{{meal.mealsName}}</span>
									</template>
								</td>
								<td>{{item.studentName}}</td>
								<td>￥{{item.realMoney}}</td>
								<td>{{item.createTime}}</td>
								<td>{{payMap[item.payMode]}}</td>
								<td>
									<!--订金默认就是已退费-->
									<template v-if="item.billMode==4">
										已退费
									</template>
									<template v-else>
										{{orderRefundMap[item.orderRefundEntity.orderRefundState]}}
									</template>
								</td>
								<td>
									<span class="detail_btn" @click="openDetail(item)">详情</span>
								</td>
							</tr>
						</tbody>
					</table>
					<el-pagination
				      layout="total, sizes, prev, pager, next, jumper"
				      :current-page="param.currPage"
				      :page-size="param.pageSize"
				      @size-change="pageSizeChange"
			      	  @current-change="pageIndexChange"
				      :total="count">
				    </el-pagination>
				</div>
				
			</div>
		</div>
		
		<el-dialog class="chargespopup" :title="moneyDetailsPopup.title" :visible.sync="moneyDetailsPopup.visible"
			:center="moneyDetailsPopup.operationType==2">
			<chargespopup ref="chargespopup" :chargespopup='moneyDetailsPopup.data'
			 @hideMe="hideChargesPopup"></chargespopup>
		</el-dialog>
	</div>
</template>

<script>
import chargespopup from './common/chargespopup'

var vm,dict,chart1,chart2;
export default {
	components : {
		chargespopup
	},
	data: function(){
		return {
			title : this.$route.name,
			param : {
				queryType : 2,
				keyName : "",
				campusId : this.$store.state.campusId,
				currPage : 1,
				pageSize : 10,
				accountUserId :"",
				startTime : "",
				endTime :""
			},
			refundList : [],
			count : null,
			timeType : null, //时间类型
			customTime : null,//自定义时间
			allMoney : 0,
			//数据字典
			payMap : null,
			orderRefundMap : null,
			_billmode : null,
			_courseMode : null,
			course_time_mode : null,
			//收费退费详情弹窗
			moneyDetailsPopup:{
				visible:false,
				title:'费用详情',
				data:null,
				operationType:0
			},
			_dictData : null
		}
	},
	methods : {
		search : function(currPage) {
			vm.param.currPage = currPage || 1;
			api.moneyList(vm.param).then(function(data) {
				vm.refundList = data.list;
				vm.count = data.totalCount;
			})
		},
		openDetail : function(refund) {
			var typeMap = {2: "报名退费", 4: "订金退费", 5: "商品退费", 8: "餐费退费"};
			var type = typeMap[refund.billMode];
			this.moneyDetailsPopup.visible=true;
			this.showChargesPopup(type, refund, 1);
		},
		statistics : function() {
			//根据支付类型统计
			var param = { campusId : vm.$store.state.campusId };
			api.refundByPayMode(param).then(function(data) {
				//遍历获取的支付类型对应的金额
				var all = 0;
				var list = [0,0,0,0,0,0];
				data.info.forEach(function(item){
					//记录到支付金额列表,累加总金额
					let index = (item.payMode>=list.length? 0 : item.payMode);
					list[index] = item.totalMoney;
					all += item.totalMoney;
				})
				//加个四舍五入运算,不然有可能会出现  x.xx00000001
				vm.allMoney = parseFloat(all.toFixed(2));
				vm.loadChart1(list);
			});
			
			
			//根据时间统计
			var day = new Date();
			//1月份按天统计
			var type = (day.getMonth()==0 ? 2 : 1);
			
			param = {
				campusId : vm.$store.state.campusId,
				orderType : 2,
				startTime : tool.DateToString(day, "yyyy-01-01 00:00:00"),
				endTime : tool.DateToString(day, "yyyy-MM-dd 23:59:59"),
				groupType : type 
			}
			api.moneyByTime(param).then(function(data) {
				//把数组解析成map
				var dataMap = {};
				data.list.forEach(function(item) {
					dataMap[item.dateTime] = item.totalMoney;
				})
				let list = [];
				//按月统计
				if(type == 1) {
					let m = day.getMonth();
					for(let i=0; i<=m; i++) {
						day.setMonth(i)
						//获取金额
						let key = tool.DateToString(day, "yyyy-MM");
						let money = dataMap[key] || 0;
						//单位转为万元,存入数组
						list.push(money/10000);
					}
				}
				if(type == 2) {
					let d = day.getDate();
					for(let i=1; i<=d; i++) {
						day.setDate(i);
						//获取金额
						let key = tool.DateToString(day, "yyyy-MM-dd");
						let money = dataMap[key] || 0;
						//单位转为万元,存入数组
						list.push(money/10000);
					}
				}
				
				vm.loadChart2(list, type);
			})
			
		},
		campusChange : function(campusId) { //校区改变
			vm.param.campusId = campusId;
			vm.search();
			vm.statistics();
		},
		pageSizeChange : function(val) { //页条数改变
	  		vm.param.pageSize = val;
	  		vm.search();
	  	},
	  	pageIndexChange : function(val) { //页码改变
	    	vm.param.currPage = val;
	    	vm.search(val);
	    	//清空选择列表
	  	},
		selectTimeType : function(timeType) {
			//时间类型没变,不做修改
			if(vm.timeType == timeType) {
				return;
			}
			vm.timeType = timeType;
			var now = new Date();
			
			if(timeType == "day") {
				vm.param.startTime = tool.DateToString(now, "yyyy-MM-dd 00:00:00");
				vm.param.endTime = tool.DateToString(now, "yyyy-MM-dd 23:59:59");
			}
			if(timeType == "week") {
				let d = now.getDay() || 7;
				now.setDate(now.getDate() - d + 1);
				vm.param.startTime = tool.DateToString(now, "yyyy-MM-dd 00:00:00");
				now.setDate(now.getDate() + 6);
				vm.param.endTime = tool.DateToString(now, "yyyy-MM-dd 23:59:59");
			}
			if(timeType == "month") {
				let d = now.getDay();
				now.setDate(1);
				vm.param.startTime = tool.DateToString(now, "yyyy-MM-dd 00:00:00");
				now.setMonth(now.getMonth() + 1);
				now.setDate(now.getDate() - 1);
				vm.param.endTime = tool.DateToString(now, "yyyy-MM-dd 23:59:59");
			}
			vm.search();
		},
		customTimeChange : function() {
			//初次点击,没有值
			if(!vm.customTime) {
				return;
			}
			vm.timeType = "custom";
			var start = vm.customTime[0] + " 00:00:00";
			var end =  vm.customTime[1] + " 23:59:59";
			var p = vm.param;
			
			//必须开始或者结束时间不一样,才进行搜索,避免重复请求
			if(start != p.startTime || end != p.endTime) {
				p.startTime = start;
				p.endTime = end;
				vm.search();
			}
		},
		loadChart1 : function(list) {
			var option1 = {
				grid : {
					show : false,
					left: '26%', 
					right: '35%', //位置信息计算标签入内
    				top : "11%", 
    				bottom: '11%',
				},
			    xAxis: {
			    	show : false,
			    	type: 'value'
			    },
			    yAxis: {
			    	show : true,
			        type: 'category',
			        data: ['其他退款', '银联退款', '现金退款', '微信退款', '支付宝退款', 'POS机退款'],
			        axisTick :{
			        	show : false
			        },
			        axisLabel : {
			        	color : "#666666",
			        	fontSize : 0.17*rem,
			        	fontFamily : "Microsoft YaHei",
			        	margin : 0.07*rem
			        },
			        axisLine : {
			        	lineStyle : {
			        		color : "#dcdcdc"
			        	}
			        }
			    },
			    series: [{
			        data: list,
			        type: 'bar',
		            label: {
	                    show: true,
	                    position: 'right',
		                color : "#333333",
		                fontSize : 0.18*rem,
			        	formatter: '￥{c}',
			        	distance: 0.05*rem,
			        	fontFamily : "Microsoft YaHei"
		            },
			        itemStyle :{
			        	color : "#4990f9",
			        	barBorderRadius : 0.04*rem
			        },
			        barWidth : 0.23*rem,
			    },
			    
			    ]
			};
			chart1.clear()
			chart1.setOption(option1, true);
		},
		loadChart2 : function(list, type) {
			//按月统计
			if(type == 1) {
				var xData = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
				xData.length  = list.length;
			}
			//按天统计
			if(type == 2) {
				var xData = ['1','2','3','4','5','6','7','8','9','10','','12','','14','','16','','18','','20','','22','','24','','26','','28','','30',''];
				xData.length  = list.length;
			}
			
			var titleFormat = (type == 1 ? "yyyy年" : "yyyy年MM月");
			
			
			var option2 = {
				title : {
					text: tool.DateToString(new Date(), titleFormat), //标题文本
					show : true,
					textStyle : {   //文本的样式
						color : "#333", //文字颜色
						fontWeight : "normal",
						fontFamily : "Microsoft YaHei", //文字字体
						fontSize : 0.14*rem, //文字大小
						align : "right", //水平对齐方式 ?
					},
					right : "6%", //右侧位置
					top : 0.12*rem, //顶部位置
				},
				tooltip : {
					show : true,
					formatter : function(params) {
						return "￥"+Math.floor(params.data * 10000);
					}
				},
				grid : {
					show : false,
					left: '8.5%', 
					right: '5%', //位置信息计算标签入内
    				top : "16%", 
    				bottom: '18%',
				},
			    xAxis: {
			        type: 'category',
			        data: xData,
//					data: ['1','','3','','5','','7','','9','','11','','13','','15','','17','','19','','21','','23','','25','','27','','29','','31'],
			    	axisLine : {
			        	show : true,
			        	lineStyle : {
			        		color : "#b1b1b1"
			        	}
			        },
			    	axisTick :{
			        	show : false
			        },
			        axisLabel : {
			        	color : "#333333",
			        	fontSize : 0.17*rem,
			        	fontFamily : "Microsoft YaHei",
			        	margin : 0.1*rem
			        },
			    },
			    yAxis: {
			        type: 'value',
			        name : "（万元）",
			        nameTextStyle : {
			        	color : "#666666",
			        	fontSize : 0.14*rem,
			        	fontFamily : "Microsoft YaHei",
			        	padding: [0, 0.7*rem, 0, 0],
			        },
			        nameGap : 0.15*rem,
			        axisLine : {
			        	show : false
			        },
			        axisTick :{
			        	show : false
			        },
			        axisLabel : {
			        	color : "#666666",
			        	fontSize : 0.16*rem,
			        	fontFamily : "Microsoft YaHei",
			        	margin : 0.12*rem
			        },
			        splitLine : {
			       		lineStyle: {
			       			color : "#f7f7f7"
			       		}
			        }
			    },
			    series: [{
			    	symbol : "circle",
			    	symbolSize: 0.1*rem,
			        data: list,
			        type: 'line',
			        smooth: true,
			        itemStyle : {
			        	color : "#4990f9",
			        	borderColor: '#ffffff',
						borderWidth: 0.02*rem,
			        }
			    }]
			};
			chart2.clear()
			chart2.setOption(option2, true);
		},
		/**隐藏收退费详情（审核）弹窗 */
		hideChargesPopup : function() {
			this.moneyDetailsPopup.visible=false;
		},
		/**显示收费、退费管理弹窗 */
		showChargesPopup : function (type,data,operationType){
			if(!data)return;
			if(!data.refundCourseData)data.refundCourseData=[];
			this.moneyDetailsPopup.operationType=operationType;
			if(operationType==1){
				this.moneyDetailsPopup.title='退费详情';
			}
			else if(operationType==2){
				this.moneyDetailsPopup.title='退费审核';
			}
			let fields=this.getFieldsNameInChargesPopup(type);
			let match={
				2:'现金退款',
				3:'微信退款',
				4:'支付宝退款',
				1:'银联退款',
				5:'POS机退款',
				100:'原路返回'
			};
			let param={
				//收退费类型
				moneyType:type,
				//操作：1-查看/2-审核
				operationType:operationType,
				title:{
					row1:'学员信息',
					row2:fields.title2
				},
				studentInfo:{
					row1_clo1:{
						name:'学员姓名：',
						value:data.studentName
					},
					row1_clo2:{
						name:'联系人：',
						value:data.parentName
					},
					row1_clo3:{
						name:'联系电话：',
						value:data.studentPhone
					},
					row1_clo4:{
						name:fields.studentInfo.row1_clo4,
						value:data.createTime
					},
					row2_clo1:{
						name:fields.studentInfo.row2_clo1,
						value:data.payeeName
					},
					row2_clo2:{
						visible:true,
						name:fields.studentInfo.row2_clo2,
						value:data.payeeTel
					}
				},
				tableObj:{
					type:type,
					statistics:{
						'row1':{
							name:fields.tableObj.row1,
							value:''
						},
						'row2':{
							name:fields.tableObj.row2,
							value:data.realMoney
						},
						'row3':{
							visible:false,
							name:fields.tableObj.row3,
							value:'测试'
						}
					},
					table:{
						thead:[],
						tbody:[]
					}
				},
				otherIfo:{
					row1:{
							name:fields.otherIfo.row1,
							value:match[data.payMode]||''
					},
					row2:{
							name:fields.otherIfo.row2,
							value:data.executeUserName
					},
					row3:{
							name:fields.otherIfo.row3,
							value:data.createUserName
					},
					row4:{
							name:fields.otherIfo.row4,
							value:data.refundRemark
					},
					row5:{
							name:'订单号：',
							value:''//data.orderRefundEntity.orderRefundId
					},
					row6:{
							name:'第三方订单号：',
							value:''//data.orderRefundEntity.payOrderNo
					},
					row7:{
							name:'订单状态：',
							value:'已退款'
					},
				}
			};
			if(type=='报名退费'){
				if(data.orderRefundEntity){
					param.otherIfo['row5'].value=data.orderRefundEntity.orderRefundId;//订单号
					param.otherIfo['row6'].value=data.orderRefundEntity.payOrderNo;//第三方订单号
				}
				//退费状态
				let statu8='';
				if(data.orderRefundState==1)statu8='待审核';
				else if(data.orderRefundState==2)statu8='已退款';
				else if(data.orderRefundState==3)statu8='退费驳回';
				param.otherIfo.row7.value=statu8;

				param.tableObj.table.thead=[
					{propName:'clo1',labelNmae:'名称'},
					{propName:'clo2',labelNmae:'收费模式'},
					{propName:'clo3',labelNmae:'购买课时'},
					{propName:'clo4',labelNmae:'课程单价'},
					{propName:'clo5',labelNmae:'课程总价'},
					{propName:'clo6',labelNmae:'实际支付'},
					{propName:'clo7',labelNmae:'已上课时'},
					{propName:'clo8',labelNmae:'课耗'},
					{propName:'clo9',labelNmae:'剩余课时'},
					{propName:'clo10',labelNmae:'剩余课程费用'},
					{propName:'clo11',labelNmae:'应退费'},
				];
				param.tableObj.table.tbody=[];
				let sum=0;
				for(let i=0;i<data.refundCourseData.length;i++){
					let row=data.refundCourseData[i];
					param.tableObj.table.tbody.push({
						classmode:'课程',
						clo1:row.courseName,clo2:row.chargeModeName,clo3:row.buyHour,clo4:'￥'+row.courseOnePrice,
						clo5:'￥'+row.courseTotalPrice,clo6:'￥'+row.realMoney/*realPayMoney*/,clo7:row.useClassHour,clo8:'￥'+row.useMoney,
						clo9:row.surplusClassHour,clo10:'￥'+row.surplusMoney,clo11:'￥'+row.refundMeoey
					});
					sum+=row.refundMeoey;
				}
				param.tableObj.statistics.row1.value=sum;
			}
			else if(type=='商品退费'){
				if(data.orderRefundEntity){
					param.otherIfo['row5'].value=data.orderRefundEntity.orderRefundId;//订单号
					param.otherIfo['row6'].value=data.orderRefundEntity.payOrderNo;//第三方订单号
				}
				param.tableObj.table.thead=[
					{propName:'clo1',labelNmae:'名称'},
					{propName:'clo2',labelNmae:'商品分类'},
					{propName:'clo3',labelNmae:'商品单价'},
					{propName:'clo4',labelNmae:'购买数量'},
					{propName:'clo5',labelNmae:'总价'},
					{propName:'clo6',labelNmae:'实际支付'},
					{propName:'clo7',labelNmae:'需退数量'},
					{propName:'clo8',labelNmae:'应退费'}
				];
				param.tableObj.table.tbody=[];
				
				let goosModeMatch=tool.parseDict(this._dictData.goods_mode);
				let sum=0;
				for(let i=0;i<data.refundGoodsData.length;i++){
					let row=data.refundGoodsData[i];
					param.tableObj.table.tbody.push({
						classmode:'商品',
						clo1:row.goodsName,
						clo2:goosModeMatch[row.goodsMode],
						clo3:'￥'+(row.goodsOneMoney||0),
						clo4:row.goodsNum,
						clo5:'￥'+(row.totalMoney||0),
						clo6:'￥'+(row.realMoney||0),
						clo7:row.goodsNum,
						clo8:'￥'+(row.realMoney||0),
					});
					sum+=row.totalMoney;
				}
				param.tableObj.statistics.row1.value=sum;
			}
			else if(type=='订金退费'){
				param.otherIfo['row5'].value=-1;//订单号
				param.otherIfo['row6'].value=-1;//第三方订单号
				
				param.tableObj.table.thead=[
					{propName:'clo1',labelNmae:'缴费时间'},
					{propName:'clo2',labelNmae:'订金'},
					{propName:'clo3',labelNmae:'实际支付'},
					{propName:'clo4',labelNmae:'应退费'}
				];
				param.tableObj.table.tbody=[];
				for(let i=0;i<5;i++){
					param.tableObj.table.tbody.push({
						classmode:'订金',
						clo1:'2019.04.05 10:30',
						clo2:'￥200',
						clo3:'￥200',
						clo4:'￥200'
					});
				}
			}
			else if(type=='餐费退费'){
				if(data.orderRefundEntity){
					param.otherIfo['row5'].value=data.orderRefundEntity.orderRefundId;//订单号
					param.otherIfo['row6'].value=data.orderRefundEntity.payOrderNo;//第三方订单号
				}
				param.tableObj.table.thead=[
					{propName:'clo1',labelNmae:'名称'},
					{propName:'clo3',labelNmae:'单价'},
					{propName:'clo4',labelNmae:'购买数量'},
					{propName:'clo5',labelNmae:'总价'},
					{propName:'clo6',labelNmae:'实际支付'},
					{propName:'clo7',labelNmae:'需退数量'},
					{propName:'clo8',labelNmae:'应退费'}
				];
				param.tableObj.table.tbody=[];
				
				let goosModeMatch=tool.parseDict(this._dictData.goods_mode);
				let sum=0;
				for(let i=0;i<data.refundMealsData.length;i++){
					let row=data.refundMealsData[i];
					param.tableObj.table.tbody.push({
						classmode:'餐费',
						clo1:row.mealsName,
						clo3:'￥'+(row.price||0),
						clo4:row.mealsNum,
						clo5:'￥'+(row.totalMoney||0),
						clo6:'￥'+(row.realMoney||0),
						clo7:row.mealsNum,
						clo8:'￥'+(row.realMoney||0),
					});
					sum+=row.totalMoney;
				}
				param.tableObj.statistics.row1.value=sum;
			}
			
			if(!this.moneyDetailsPopup.data){
				this.moneyDetailsPopup.data=param;
			}
			else{
				this.$refs.chargespopup.updateByData(param)
			}
		},
		matchCourseTimeMode(value){
			let course_time_mode=this.course_time_mode;
			for(let j =0;j<course_time_mode.length;j++){
				if(value==course_time_mode[j].value){
					return course_time_mode[j].name;
				}
			}
		},
		getFieldsNameInChargesPopup(type){
			let fields={
				title2:'',
				studentInfo:{},
				tableObj:{},
				otherIfo:{}
			};
			switch(type){
				case '报名退费':{
					fields.title2='课程退费详情';
					fields.studentInfo['row1_clo4']='退款时间：';
					fields.studentInfo['row2_clo1']='收款人：';
					fields.studentInfo['row2_clo2']='收款人电话：';
					fields.tableObj['row1']='应退总计：';
					fields.tableObj['row2']='实际退款：';
					fields.tableObj['row3']='手动修改退费价格：';
					fields.otherIfo['row1']='退款方式：';
					fields.otherIfo['row2']='跟单人：';
					fields.otherIfo['row3']='退款人：';
					fields.otherIfo['row4']='退费原因：';
					break;
				}
				case '商品退费':{
					fields.title2='商品退费详情';
					fields.studentInfo['row1_clo4']='退款时间：';
					fields.studentInfo['row2_clo1']='收款人：';
					fields.studentInfo['row2_clo2']='收款人电话：';
					fields.tableObj['row1']='应退总计：';
					fields.tableObj['row2']='实际退款：';
					fields.tableObj['row3']='手动修改退费价格：';
					fields.otherIfo['row1']='退款方式：';
					fields.otherIfo['row2']='跟单人：';
					fields.otherIfo['row3']='退款人：';
					fields.otherIfo['row4']='退费原因：';
					break;
				}
				case '订金退费':{
					fields.title2='订金退费详情';
					fields.studentInfo['row1_clo4']='退款时间：';
					fields.studentInfo['row2_clo1']='收款人：';
					fields.studentInfo['row2_clo2']='收款人电话：';
					fields.tableObj['row1']='应退总计：';
					fields.tableObj['row2']='实际退款：';
					fields.tableObj['row3']='手动修改退费价格：';
					fields.otherIfo['row1']='退款方式：';
					fields.otherIfo['row2']='跟单人：';
					fields.otherIfo['row3']='退款人：';
					fields.otherIfo['row4']='退费原因：';
					break;
				}
				case '餐费退费':{
					fields.title2='餐费退费详情';
					fields.studentInfo['row1_clo4']='退款时间：';
					fields.studentInfo['row2_clo1']='收款人：';
					fields.studentInfo['row2_clo2']='收款人电话：';
					fields.tableObj['row1']='应退总计：';
					fields.tableObj['row2']='实际退款：';
					fields.tableObj['row3']='手动修改退费价格：';
					fields.otherIfo['row1']='退款方式：';
					fields.otherIfo['row2']='跟单人：';
					fields.otherIfo['row3']='退款人：';
					fields.otherIfo['row4']='退费原因：';
					break;
				}
			}
			return fields;
		}
	},
	mounted : function() {
		chart1 = $echarts.init($("#chart1")[0]);
		chart2 = $echarts.init($("#chart2")[0]);
		
		vm.statistics();
		
//		var interId =  setInterval(function(){
//			vm.statistics();
//		},5000);
//		
//		vm.$once('hook:beforeDestroy', () => {            
//		    clearInterval(interId)                              
//		})
		
	},
	created : function() {
		vm = this;
		
		//获取用户和数据字典对象
		dict = tool.getItem(lsKey.dict,true);
		vm._dictData = dict;
		vm.payMap = tool.parseDict(dict["pay_mode"]);
        vm.orderRefundMap = tool.parseDict(dict["order_refund_state"]);
        
        vm._billmode=dict.bill_mode;
		vm._courseMode=dict.course_mode;
		vm.course_time_mode=dict.course_time_mode;
        
        //初始化数据
        vm.selectTimeType('day');
        
	}
	
}
</script>

<style lang="scss">
#refund_query {
	.el-input__inner {
		border-radius: 0.08rem;
		font-size: 0.16rem;
		color: #666666;
		height: 0.36rem !important;
		line-height: 0.36rem;
	}
	.el-input__icon {
		line-height: 0.36rem;
	}
	.custom_picker input {
		cursor: pointer !important;
	}
	
	.chargespopup{
		.el-dialog{
			width: 11.84rem !important;
			background-color: white !important;
			border-radius: 0.1rem !important;
			.el-dialog__header{
				.el-dialog__title{
					font-size: 0.22rem !important;
					color: #333333 !important;
					padding: 0rem 0.1rem 0rem 0.1rem;
					font-weight: bold;
				}
			}
			.el-dialog__body{
				font-size: 0.16rem !important;
				color: #666666 !important;
				padding: 0.2rem 0.3rem  !important;
			}
		}
	}
}
</style>
<style scoped src="@/style/module/table.css"></style>
<style scoped src="@/style/processing_center/charge_query.css"></style>
<style scoped>
	.table {
		border-top: none;
	}
	.el-pagination {
	    padding-top: 0.15rem;
	}
</style>